//
//  UIColor+RBExtension.m
//  FD
//
//  Created by xiaofang wang on 2018/12/29.
//  Copyright © 2018年 ZhiYuan Network. All rights reserved.
//

#import "UIColor+RBExtension.h"

@implementation UIColor (RBExtension)
+ (instancetype)rb_colorHex:(uint32_t)hex {
    return [self rb_colorHex:hex alpha:1.0];
}

+ (instancetype)rb_colorHex:(uint32_t)hex alpha:(CGFloat)alpha {
    u_int8_t red = (0xFF0000 & hex) >> 16;
    u_int8_t green = (0x00FF00 & hex) >> 8;
    u_int8_t blue = (0x0000FF & hex);
    
    return [UIColor colorWithRed:red / 255.0 green:green / 255.0 blue:blue / 255.0 alpha:alpha];
}


+ (instancetype)rb_randomColor {
    
    uint32_t r = arc4random_uniform(256);
    uint32_t g = arc4random_uniform(256);
    uint32_t b = arc4random_uniform(256);
    
    return [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1.0];    
}

@end
